home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / MacHacksBug / Python 1.5.2c1 / Mac / Tools / IDE / BuildIDE.py next >
Encoding:
Python Source  |  2000-06-23  |  1.1 KB  |  42 lines

  1. """Build a "big" applet for the IDE, and put it in the Python home 
  2. directory. It will contain all IDE-specific modules as PYC resources,
  3. which reduces the startup time (especially on slower machines)."""
  4.  
  5. import sys
  6. import os
  7. import buildtools
  8. import Res
  9. import py_resource
  10.  
  11. buildtools.DEBUG=1
  12.  
  13. template = buildtools.findtemplate()
  14.  
  15. ide_home = os.path.join(sys.exec_prefix, ":Mac:Tools:IDE")
  16.  
  17. mainfilename = os.path.join(ide_home, "PythonIDE.py")
  18. dstfilename = os.path.join(sys.exec_prefix, "Python IDE")
  19.  
  20. buildtools.process(template, mainfilename, dstfilename, 1)
  21.  
  22. targetref = Res.OpenResFile(dstfilename)
  23. Res.UseResFile(targetref)
  24.  
  25. files = os.listdir(ide_home)
  26.  
  27. # skip this script and the main program
  28. files = filter(lambda x: x[-3:] == '.py' and 
  29.         x not in ("BuildIDE.py", "PythonIDE.py"), files)
  30.  
  31. # add the modules as PYC resources
  32. for name in files:
  33.     print "adding", name
  34.     fullpath = os.path.join(ide_home, name)
  35.     id, name = py_resource.frompyfile(fullpath, name[:-3], preload=1,
  36.         ispackage=0)
  37.  
  38. # add W resources
  39. wresref = Res.OpenResFile(os.path.join(ide_home, "Widgets.rsrc"))
  40. buildtools.copyres(wresref, targetref, [], 0)
  41.  
  42.